import BaseComps from './base-comps/index.js'
import AdvancedComps from './advanced-comps/index.js'
import ContainerComps from './container-comps/index.js'
import ChartComps from './chart-comps/index.js'
import BigdataComps from './bigdata-comps/index.js'
import ExtComps from './ext-comps/index.js'

// 组件配置
export const compConfig = {
  componentModules: {},
  componentMap: {},
  registry: (moduleName, key, component) => {
    if (!Array.isArray(compConfig.componentModules[moduleName])) {
      compConfig.componentModules[moduleName] = []
    }
    compConfig.componentModules[moduleName].push(component)
    compConfig.componentMap[key] = component
  }
}

// 注册[基础组件]
Object.entries(BaseComps).forEach(([name, comp]) => compConfig.registry('base-comps', name, comp))

// 注册[高级组件]
Object.entries(AdvancedComps).forEach(([name, comp]) => compConfig.registry('advanced-comps', name, comp))

// 注册[容器组件]
Object.entries(ContainerComps).forEach(([name, comp]) => compConfig.registry('container-comps', name, comp))

// 注册[图表组件]
Object.entries(ChartComps).forEach(([name, comp]) => compConfig.registry('chart-comps', name, comp))

// 注册[大数据组件]
Object.entries(BigdataComps).forEach(([name, comp]) => compConfig.registry('bigdata-comps', name, comp))

// 注册[扩展组件]
Object.entries(ExtComps).forEach(([name, comp]) => compConfig.registry('ext-comps', name, comp))
